home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / db / esm-3.1 / esm-3 / usr / local / sm / src / serverlib / include / volume.h < prev   
Encoding:
C/C++ Source or Header  |  1996-05-05  |  4.3 KB  |  168 lines

  1. /*
  2.  *   $RCSfile: volume.h,v $  
  3.  *   $Revision: 1.1.1.1 $  
  4.  *   $Date: 1996/05/04 21:55:46 $      
  5.  */ 
  6. #ifndef __VOLUME_H__
  7. #define __VOLUME_H__
  8.  
  9. /**********************************************************************
  10. * EXODUS Database Toolkit Software
  11. * Copyright (c) 1991 Computer Sciences Department, University of
  12. *                    Wisconsin -- Madison
  13. * All Rights Reserved.
  14. *
  15. * Permission to use, copy, modify and distribute this software and its
  16. * documentation is hereby granted, provided that both the copyright
  17. * notice and this permission notice appear in all copies of the
  18. * software, derivative works or modified versions, and any portions
  19. * thereof, and that both notices appear in supporting documentation.
  20. *
  21. * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
  22. * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.  
  23. * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
  24. * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  25. *
  26. * The EXODUS Project Group requests users of this software to return 
  27. * any improvements or extensions that they make to:
  28. *
  29. *   EXODUS Project Group 
  30. *     c/o David J. DeWitt and Michael J. Carey
  31. *   Computer Sciences Department
  32. *   University of Wisconsin -- Madison
  33. *   Madison, WI 53706
  34. *
  35. *     or exodus@cs.wisc.edu
  36. *
  37. * In addition, the EXODUS Project Group requests that users grant the 
  38. * Computer Sciences Department rights to redistribute these changes.
  39. **********************************************************************/
  40. #include "ess.h"
  41. #include "checking.h"
  42. #include "io.h"
  43. #include "bf.h"
  44. #include "list.h"
  45. #include "link.h"
  46.  
  47. #include "VOLIDCLASS.h"
  48. #include "forward.h"
  49. #include "resources.h"
  50.  
  51. /*
  52.  * this needs the definition of VOLUME_TABLE_MAX_SIZE 
  53.  */
  54. #include "queues.h"
  55.  
  56. #ifndef DISKPROC_MAKE
  57.  
  58. typedef struct {
  59.     FLAGS volflags;     /* volflags and properties */
  60.     int numCylinders, tracksPerCylinder, pagesPerTrack,
  61.                     numLogFileBlocks, logFileBlock2size;
  62. } FORMATINFO;
  63.  
  64. class VOLNAMEREC {
  65. public:
  66.     VOLUMENAME    volName;
  67.     VOLID        volid;
  68.     LIST        nameHashList;
  69.     LIST        volidHashList;
  70.     FORMATINFO    *fmtinfo; 
  71.  
  72.     void Dump(FILE *f);
  73.     VOLIDCLASS *keylocation (int unique, VOLIDCLASS **unused);
  74.     VOLUMENAME *keylocation (int unique, VOLUMENAME **unused);
  75.     LISTELEMENT *listlocation (int unique);
  76.     void ReInit();
  77.     void Init();
  78. };
  79.  
  80. /*
  81.  *    the in-memory structure that holds a disk header
  82.  */
  83. class VOLREC {
  84. public:
  85.     VOLID        volid; /* Hate to have it copied from header->volid, 
  86.                         * but the HashTable funcs need to have the
  87.                         * key located in the structure
  88.                         */
  89.     VOLHDR        *header;
  90.     GROUPLINK    *headerLink;
  91.     BOOL        dirty;
  92.     LINK        *volLink;    
  93. /*
  94.     DIRROOT        *rootPage;
  95.     char        *freeBitmap;
  96.     char        *uniqueBitmap;
  97.     char        *slotBitmap;
  98.     char        *fileBitmap;
  99. */
  100.     int            index;
  101.     LATCH        latch;
  102.     LIST        openList;
  103.     LIST        tcbList;
  104.     LIST        activeTransList;
  105.     LISTELEMENT    hashList;
  106.     FLAGS        volflags;
  107.     BUFGROUP    *bufGroup;
  108.     SHORTPID    lastAllocPage;
  109.     VOLNAMEREC     *volNameRec;
  110.     QUEUEPAIR    *queues;    
  111.     pid_t        diskrwPid;
  112.     int            fd;                /* file descriptor of opened disk volume 
  113.                                  * used for "fast" path 
  114.                                  */
  115.  
  116.     inline BOOL equalFunc(VOLREC *other) const {
  117.          return other->volid == this->volid; 
  118.      };
  119.     inline int hashFunc() const { return (int)(this->volid); };
  120.     void Dump(FILE *f);
  121.     VOLIDCLASS *keylocation (int unique, VOLIDCLASS **unused);
  122.     LISTELEMENT *listlocation (int unique);
  123.     void ReInit(); 
  124.     void Init();
  125. };
  126.  
  127.  
  128. /*
  129.  *    define states of the record
  130.  *  NB: VOLPROP* had better fit nicely in to this!  
  131.  */
  132. #define VOL_FREE        0x0            /* entry is free                        */
  133. #define    VOL_TEMP        VOLPROP_TEMP
  134. #define    VOL_RAWDEV        0x2
  135. #define    VOL_LOG            VOLPROP_LOG
  136. #define VOL_OPEN        0x10        /* the volume contains a mounted entry    */
  137. #define VOL_INIT        0x20        /* the volume connections are initing    */
  138. #define VOL_INVALID        0x40        /* the link to the diskproc is invalid    */
  139. #define VOL_QUIESCE        0x80        /* the volume is being closed            */
  140. #define VOL_FORMAT        0x100        /* volume is in table for formatting only */
  141. #define VOL_DISPLAY        0x200        /* used for displaying format (by formatvol only) */
  142.  
  143.  
  144. /*
  145.  *    structure that joins links and disks
  146.  */
  147. typedef struct    {
  148.  
  149.     VOLID        volid;
  150.     VOLREC        *volRec;
  151.     LINK        *link;
  152.     LISTELEMENT    linkList;
  153.     LISTELEMENT    volList;
  154.  
  155. } VOLINFO;
  156.  
  157.  
  158. /*
  159.  *    Structure logged at checkpoint to record all mounted volumes
  160.  */
  161.  typedef struct {
  162.     VOLID            volid;
  163.     _VOLUMENAME_    volName;
  164.  } VOLIDNAME;
  165.  
  166. #endif DISKPROC_MAKE
  167. #endif __VOLUME_H__
  168.